//
//  BaseViewController.m
//  ParagonCure
//
//  Created by 牛晴晴 on 16/7/5.
//  Copyright © 2016年 SH. All rights reserved.
//

#import "BaseViewController.h"
#import "UIViewController+JASidePanel.h"

@interface BaseViewController ()

@end

@implementation BaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = WHITE_COLOR;
    self.navigationController.navigationBar.barTintColor = kThemeColor;
    
    [self setUpLeftButtonItem];
}

//默认修改了左上角的itme值,滑动之后,左侧页面,点击cell跳转页面的白色回退箭头
- (void)setUpLeftButtonItem{
    
    UIButton *leftBtn= [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 40, 40)];
    [leftBtn setImage:[UIImage imageNamed:@"JianTou"] forState:UIControlStateNormal];
    
    [leftBtn addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside];
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:leftBtn];
    
}

/**
 *  想任意跳转重写goBack方法
 */
- (void)goBack{

    [self.navigationController popViewControllerAnimated:YES];
}

//*********[侧滑]************
//***中间***

- (UINavigationController *)centerNavigationController{

    return (UINavigationController *)self.sidePanelController.centerPanel;
}

//左侧VC
- (UIViewController *)leftMenuViewController{

    return self.sidePanelController.leftPanel;
}


-(void)jumpToOtherViewController:(UIViewController *)otherVC{

    //显示中间的panel
    [self.sidePanelController showCenterPanelAnimated:YES];
    
    //push到指定的vc
    [[self centerNavigationController] pushViewController:otherVC animated:YES];
}


//*********[侧滑]**************
@end
